import api from '@/config/api';
import { http } from '@/utils/request';

/**
 * 获取微信消息订阅
 * @param params
 * @returns {AxiosPromise}
 */
export function getWeChatMpMessage() {
  return http.request({
    url: 'passport/connect/mini-program/subscribeMessage',
    method: "GET"
  });
}


/**
 * 站内消息相关API
 */

//获取站内消息
export function messages(params: any) {
  return http.request({
    url: `${api.common}/message`,
    method: "GET",
    params,
  });
}

//读取站内消息
export function editMessages(message_id: number | string, params: any){
  return http.request({
    url: `${api.common}/message/${message_id}`,
    method: "PUT",
    params
  })
}

/**
 * 获取聊天列表
 * @param {*} talkId
 * @returns
 */
 export function getTalkList(params) {
  return http.request({
    url: `${api.im}/talk/list`,
    method: "GET",
    params
  });
}

// 清除未读
export function clearmeaager() {
  return http.request({
    url: `${api.im}/message/clean/unred`,
    method: "PUT",
  });
}

